@{
    ViewBag.Title = "添加资源";
    }
@section head{
   <link href="@Url.Content("~/Content/Images/UploadIcons/icons.css")" rel="stylesheet" type="text/css" />
   <script src="@Url.Content("~/Content/JavaScript/packages/SWFUpload_v2.2.0.1/swfupload.js")" type="text/javascript"></script>
   <script src="@Url.Content("~/Content/JavaScript/upload_file.js")" type="text/javascript"></script>

   <script type="text/javascript">
       var swfu;
       var uploadwebsiteurl = '@Url.Action("UpLoadFile","Tools")?customSavePath=/Content/Images/UploadIcons';
       var uploadmenuurl = '@Url.Action("UploadIcon","Tools")';
       $(document).ready(function () {
           swfu = singleUploadFileAutoReturn(uploadmenuurl, '#IconCls', 'upload_button', '.uploading', true, false);
           $('.btnSubmit').click(function () {
               ajax_submit('#content', undefined, function (r) {
                   if (r.success) {
                       CloseMe();
                   }
               });
               return false; //兼容FF
           });

           $('[name=Type]').click(function () {
               if ($(this).val() == '1') {
                   $('.menut,.buttont').hide();
                   $('.websitet').show();
                   $('#ParentCode').combotree("options").required = false;
                   $('#WebSiteCode').combobox({ required: false });
                   try { swfu.setUploadURL(uploadwebsiteurl); } catch (e) { }
               }
               else if ($(this).val() == '2') {
                   $('.websitet,buttont').hide();
                   $('.menut').show();
                   $('#ParentCode').combotree("options").required = true;
                   $('#WebSiteCode').combobox({ required: true });
                   try{swfu.setUploadURL(uploadmenuurl);}catch(e){}
               }
               else {
                   $('.websitet,.menut').hide();
                   $('.buttont').show();
                   $('#ParentCode').combotree("options").required = true;
                   $('#WebSiteCode').combobox({ required: true });
               }
           });
           $('#Type_2').click();
       });
       function websiteselect(record) {
           $('#ParentCode').combotree({ url: '@Url.Action("MenuTree")?websiteCode=' + record.id });
       }
   </script>
}
@section body{
<body>
   <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'north',border:false">
            <div class="navigation">
                <div class="left">
                   @ViewBag.CurrentPath 添加
                </div>
                <a href="javascript:CloseMe();" class="back">后退</a>
            </div>
            <div class="expand_margin"></div>
        </div> 
        <div id='content' data-options="region:'center',border:false" >
             <div class="easyui-tabs" data-options="plain:true,border:false,fit:true">
                <div title="编辑资源信息">  
                    <table class="form_table">
                        <col width="180px"/>
                        <tbody>
                        <tr>
                            <th>类型：</th>
                            <td>
                                @Html.Raw(OA.UI.Controls.RadioByDictionary("Type","ResourceType",null,null))
                            </td>
                        </tr>
                        <tr>
                            <th>编号：</th>
                            <td>
                               <input type="text" id="Code" name="Code" class="easyui-validatebox imedisable" data-options="required:true,validType:['length[1,32]','Account']" />
                            </td>
                        </tr>
                        <tr>
                            <th>名称：</th>
                            <td><input type="text" id="Name"  name="Name" class="easyui-validatebox" data-options="required:true,validType:'length[1,32]'" /></td>
                        </tr>
                        <tr class="menut buttont">
                            <th>站点：</th>
                            <td>
                                <input id="WebSiteCode" name="WebSiteCode" class="easyui-combobox" data-options="url:'@Url.Action("WebSiteCombo")',valueField:'id',textField:'text',required:true,onSelect:websiteselect" style="width:155px;"/>
                            </td>
                        </tr>
                        <tr class="menut buttont">
                            <th>上级菜单：</th>
                            <td>
                                <input id="ParentCode" name="ParentCode" class="easyui-combotree"
                                data-options="lines:true,panelHeight:'auto'" style="width:155px;" />
                            </td>
                        </tr>
                        <tr class="menut websitet">
                            <th>地址：</th>
                            <td>
                                <input type="text" name="Address" class="easyui-validatebox" style=" width:250px;" data-options="validType:'length[1,256]'" />
                                <label>站点地址结尾不能输入 / .菜单站内地址以 / 开头，其它地址任意</label>
                            </td>                            
                        </tr>
                        <tr class="websitet menut">
                            <th>图标：</th>
                            <td>
                                <input type="text" name="IconCls" id="IconCls" style="width:250px;" class="easyui-validatebox left" />
                                <div class="btnSearch btnupload" >
                                     <span id="upload_button"></span>   
                               </div>
                                <span class="uploading"></span>
                                <label>建议尺寸:16px * 16px</label>
                            </td>
                        </tr>
                        <tr class="websitet menut">
                            <th>排序：</th>
                            <td>
                                <input type="text" id="Sort" name="Sort" value="99" class="easyui-numberspinner"
                                 data-options="min:-10000,max:10000,required:true"  style="width:155px;" />
                                <label>数字越大排序时越靠前</label>
                            </td>
                        </tr>
                        <tr class="websitet menut">
                            <th>是否显示：</th>
                            <td>
                                <input type="checkbox" id="IsShow" name="IsShow" value="true" checked="checked" />
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input type="submit" value="提交保存" class="btnSubmit" />
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>          
            </div>
        </div>
    </div>
</body>
}
